// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async ({
    action,
    data
}, context) => {
    console.log(
    action,
    data);
    console.log("data  ",data);
    
    if (action === "getMap") {
        let arr = {
            17:[{
                address:"浙江省丽水市莲都区2",
                "scale":undefined,
                "latitude": 28.465774,
                "longitude": 119.915975,
                "title": "接官亭",
                "num": 10,
                "_id": "0ab5303b62e0fb3f107f0d5245529cde",
                id:111
            }],
            11:[{
                address:"浙江省丽水市莲都区",
                "scale":17,
                "latitude": 28.464641,
                "longitude": 119.915981,
                "title": "接官亭",
                "num": 10,
                "id":1
            }, {
                address:"浙江省丽水市莲都区",
                "scale":17,
                "latitude": 28.456613,
                "longitude": 119.897371,
                "title": "三岩寺",
                "num": 10,
                "id": 2
            }],8:[{
                address:"浙江省丽水市莲都区",
                "scale":11,
                "title": "青田县",
                "num": 10,
                "id": 6,
                "latitude": 28.139814,
                "longitude": 120.289557
            }, {
                address:"浙江省丽水市莲都区",
                "scale":11,
                "title": "丽水市",
                "num": 10,
                "id": 10,
                "latitude": 28.449512,
                "longitude": 119.915945
            }]
        }
        return {
            code: 0,
            data: arr[data.scale]
        }
    }
}